import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/l10n.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/widgets/button/normal_button.dart';
import 'package:flutter/material.dart';

import 'default_bottom_sheet.dart';

/// 截止日期提示
showAsOnDateBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showTitleGotItTipBottomSheet(
        context,
        S.current
            .this_is_your_new_bank_account_opening_date_for_existing_bank_account_this_is_the_first_day_of_your_current_financial_year,
        S.current.as_at_date,
        onGotIt: onGotIt);

/// rejected
showTitleGotItTipBottomSheet(BuildContext context, String content, String title,
        {VoidCallback onGotIt}) =>
    showDefaultBottomSheet(
      context,
      child: _TitleGotItTipWidget(
        onGotIt: onGotIt,
        content: content,
      ),
      title: title,
      isScrollControlled: true,
    );

class _TitleGotItTipWidget extends StatelessWidget {
  final VoidCallback onGotIt;
  final String content;

  const _TitleGotItTipWidget({Key key, this.onGotIt, this.content})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    final titleStyle = TextStyle(
      color: aceBlackColor,
      fontSize: getSp(16),
      fontWeight: FontWeight.w400,
      height: 22 / 16,
    );
    return Padding(
      padding: EdgeInsets.only(
        left: getDp(26),
        right: getDp(26),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          SizedBox(
            height: getDp(18),
          ),
          Text(
            content,
            textAlign: TextAlign.center,
            style: titleStyle,
          ),
          SizedBox(
            height: getDp(30),
          ),
          NormalButton(
            onTap: onGotIt ??
                () {
                  Navigator.of(context).pop();
                },
            title: S.current.got_it,
          ),
        ],
      ),
    );
  }
}
